package com.flatshare.project;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class Forgot extends Activity implements View.OnClickListener{

	TextView tvForgot;
	EditText etEmail;
	Button bForgot;
	
	protected void onCreate(Bundle HomeScreen) {
		
		super.onCreate(HomeScreen);
		setContentView(R.layout.forgot);
		
		setVariables();
		setOnClickListeners();
		
	}
	private void setOnClickListeners() {
		// TODO Auto-generated method stub
		bForgot.setOnClickListener(this);
	}
	private void setVariables() {
		// TODO Auto-generated method stub
		tvForgot = (TextView) findViewById(R.id.tvForgot);
		etEmail = (EditText) findViewById(R.id.etEmail);
		bForgot = (Button) findViewById(R.id.bForgot);
	}
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		
		case R.id.bForgot:
			String check = etEmail.getText().toString();
			
			if (check.length() > 0){
				sendEmail();
				//Send email to server to compare, then on server if email found send password
				finish();
			}else{
				
				tvForgot.setText("Please insert Email");
				tvForgot.setGravity(Gravity.CENTER);
				tvForgot.setTextColor(Color.RED);
				
			}
			break;
		
		
		}
	}
	private void sendEmail() {
		// TODO Auto-generated method stub
		
	}
	
	@Override
	protected void onPause() {
		
		super.onPause();
		finish();
	}

}
